﻿using STHPMS1.BLL.B_Core;
using STHPMS1.ICore.I_BLL.Bus;
using STHPMS1.ICore.I_Entity.Info;
using STHPMS1.ICore.I_Entity.Stmpms1;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;

namespace STHPMS1.BLL.B_Bus
{
    public class Dp_Preventive_ModelBus : BllBase, IDp_Preventive_ModelBill
    {
        public void Save<T>(T entity)
            where T : class ,IDp_Preventive_Model
        {
            if (this.Scene.Dal.Sthpms1.Update(entity) == 0)
            {
                this.Scene.Dal.Sthpms1.Insert(entity);
            }
        }

        public void Remove(IDp_Preventive_Model entity)
        {
            this.Scene.Dal.Sthpms1.Delete(entity);
        }

        public IEnumerable<T> Get<T>(Expression<Func<T, bool>> predicate, IPagingInfo info)
            where T : class, IDp_Preventive_Model
        {
            return this.Scene.Dal.Sthpms1.Select<T>(predicate, info);
        }


        /// <summary>
        /// 获取预防性养护分析模型
        /// </summary>
        /// <param name="meas">养护措施</param>
        /// <param name="pci">原路面PCI</param>
        /// <param name="modelmode">模型形式</param>
        /// <returns></returns>
        public IDp_Preventive_Model GetDp_Preventive_Model(string meas, double pci, int modelmode)
        {
            return this.Scene.Dal.Sthpms1.Dp_Preventive_Model.GetDp_Preventive_Model(meas, pci, modelmode);
        }
         /// <summary>
        /// 获取预防性养护分析模型
        /// </summary>
        /// <param name="meas">养护措施</param>
        /// <param name="pci">原路面PCI</param>
        /// <param name="modelmode">模型形式</param>
        /// <returns></returns>
        public IDp_Preventive_Model GetDp_Preventive_Model(string meas, string mainsegid, int modelmode)
        {
            return this.Scene.Dal.Sthpms1.Dp_Preventive_Model.GetDp_Preventive_Model(meas, mainsegid, modelmode);
        }
    }
}
